home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- #include "stdafx.h"
- #include "..\..\include\MCDBcls.h"
- #include <conio.h>
-
- //---------------------------------------------------------------------------
- void static __stdcall OnWriteDone(BOOL, void *);
- void static __stdcall OnGetData(HANDLE FileHandle, unsigned long Position, void *buffer, unsigned long *Size, void *arg);
-
- void *MemoryFileHandle;
-
- BOOL WriteDone = FALSE;
- CMCDBurner mcdb;
- int main(int argc, char* argv[])
- {
- WIN32_FIND_DATA FindData;
- void *ps = NULL; //(void *)this
- SYSTEMTIME st;
- mcdb.ClearAll();
- mcdb.SelectDevice(0);
- memset(&FindData, 0, sizeof(FindData));
- GetSystemTime(&st); SystemTimeToFileTime(&st, &FindData.ftLastWriteTime); // Get and Set current Data and Time
- strcpy(FindData.cFileName, "MemoryFile"); // Long File Name
- strcpy(FindData.cAlternateFileName, "MEMORYFI.LE"); /// Short File Name
- FindData.nFileSizeLow = 1024000; /// File Size
- MemoryFileHandle = mcdb.InsertMemoryFile("\\", FindData, &OnGetData, ps);
- mcdb.Prepare();
- if (mcdb.TestUnitReady())
- {
- WriteDone = FALSE;
- if (mcdb.BuildISOImage("c:\\test.iso", &OnWriteDone, NULL) == TRUE)
- {
- while (!WriteDone)
- {
- SleepEx(100, TRUE);
- }
- getch();
- }
- else
- {
- printf(">>> Error! ...\n");
- }
- }
- else
- {
- printf(">>> Drive not ready ...\n");
- }
- return 0;
- }
- //---------------------------------------------------------------------------
- void __stdcall OnGetData(HANDLE FileHandle, unsigned long Position, void *buffer, unsigned long *Size, void *arg)
- {
- if (MemoryFileHandle == FileHandle)
- memset(buffer, 255, *Size);
- printf("Position: %ld - %ld\n", Position, Position+*Size);
- }
- //---------------------------------------------------------------------------
- void __stdcall OnWriteDone(BOOL FAILED, void *arg)
- {
- if (FAILED)
- printf(">>> WRITE DONE WITH ERROR (%d)\n", mcdb.GetErrorNumber());
- else
- printf(">>> WRITE DONE, NO ERROR.\n");
- printf("Press any key to continue");
- WriteDone = TRUE;
- }
-
-